﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using WPFExcelReport.Helpers;
using System.Windows.Controls;
namespace WPFExcelReport
{
    public partial class UIQTB : ViewBase
    {
        public VICC_QUERYTB TMV
        {
            get
            {
                return (VICC_QUERYTB)MV;
            }
        }
        #region ==LIEFNR===========
        public static readonly DependencyProperty LIEFNRProperty = DependencyProperty.Register("LIEFNR",
        typeof(string), typeof(UIQTB),
        new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnLIEFNRChanged));
        public string LIEFNR
        {
            get
            {
                return (string)GetValue(LIEFNRProperty);
            }
            set
            {
                SetValue(LIEFNRProperty, value);
            }
        }
        private static void OnLIEFNRChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIQTB;
            if (src != null)
            {
                src.LIEFNR = (string)e.NewValue;
            }
        }
        public virtual void OnLIEFNRBYChg(string value)
        {
        }

        #endregion
   
        public UIQTB()
        {

        }
        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            if (IsLoaded)
                return;
            
            base.Window_Loaded(sender, e);

        }
        public override void Query_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key != System.Windows.Input.Key.Enter)
                return;
            if (e.Key != System.Windows.Input.Key.Return)
                return;
            this.Focus();
            IsQuery = true; 
            base.Query_KeyUp(sender, e);
        }
        public override void OnQueryChg(bool value)
        {
            if (value)
                return;
            INFO = "";
            QTYP = "";
            base.OnQueryChg(value);
        }
        public override void QueryCommand(object sender, RoutedEventArgs e)
        {
           // Query_KeyUp(null, null);
        }
    }
}
